<template>
  <div class="create">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>用户创建</span>
        <el-button
          class="qf-r qf-create-btn"
          type="primary"
          round
          @click="jump('/users')"
          >返回</el-button
        >
      </div>

      <QfForm
        width="80px"
        :formConfig="formConfig"
        :formBtns="formBtns"
        @submit="submitFn"
      ></QfForm>
    </el-card>
  </div>
</template>

<script>
export default {
  methods: {
    submitFn(formData) {
      console.log(formData);
    },
  },
  data() {
    return {
      formConfig: [
        {
          label: "账号",
          field: "uname",
          type: "text",
          rules: [{ required: true, message: "账号必填", trigger: "blur" }],
        },
        {
          label: "密码",
          field: "pwd",
          type: "password",
          showPwd: true,
          rules: [{ required: true, message: "密码必填", trigger: "blur" }],
        },
        {
          label: "密保问题",
          field: "question",
          type: "select",
          payload: [
            { label: "母亲的名字", value: "母亲的名字" },
            { label: "爷爷的名字", value: "爷爷的名字" },
            { label: "您其中一位老师的名字", value: "您其中一位老师的名字" },
          ],
          rules: [{ required: true, message: "密保问题必填", trigger: "blur" }],
        },
        {
          label: "密保答案",
          field: "answer",
          type: "text",
          rules: [{ required: true, message: "密保问题必填", trigger: "blur" }],
        },
      ],
      formBtns: [
        {
          content: "创建",
          type: "primary",
        },
        {
          content: "重置",
          type: "",
        },
      ],
    };
  },
};
</script>
